:root {
  --bg-color: #f5f5f5;
  --sidebar-bg: #fff;
  --text-color: #333;
  --text-secondary: #666;
  --hover-bg: #f0f0f0;
  --active-bg: #1890ff;
  --active-text: #fff;
  --card-bg: #fff;
  --card-shadow: rgba(0, 0, 0, 0.1);
  --border-color: #eee;
}

[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --sidebar-bg: #2d2d2d;
  --text-color: #e0e0e0;
  --text-secondary: #aaa;
  --hover-bg: #3d3d3d;
  --active-bg: #1890ff;
  --active-text: #fff;
  --card-bg: #2d2d2d;
  --card-shadow: rgba(0, 0, 0, 0.3);
  --border-color: #404040;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color 0.3s ease;
}

.container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  background-color: var(--sidebar-bg);
  padding: 20px;
  box-shadow: 2px 0 5px var(--card-shadow);
}

.sidebar h2 {
  margin-bottom: 20px;
  color: var(--text-color);
  font-size: 1.5em;
}

.menu {
  list-style: none;
}

.menu li {
  padding: 12px 15px;
  margin-bottom: 5px;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.3s ease;
}

.menu li:hover {
  background-color: var(--hover-bg);
}

.menu li.active {
  background-color: var(--active-bg);
  color: var(--active-text);
}

.main-content {
  flex: 1;
  padding: 20px;
}

.demos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px;
}

.demo-item {
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--card-shadow);
  transition: transform 0.3s ease;
  cursor: pointer;
  padding: 20px;
}

.demo-item:hover {
  transform: translateY(-5px);
}

.demo-info {
  padding: 15px 0;
  display: flex;
  gap: 12px;
  flex-direction: column;
  align-items: center;
}

.demo-info img {
  width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: contain;
  border-radius: 8px;
  transition: transform 0.3s ease;
}

.demo-info img:hover {
  transform: scale(1.02);
}

.demo-info h3 {
  color: var(--text-color);
  font-size: 1.2em;
}

.theme-toggle {
  position: fixed;
  top: 10px;
  right: 15px;
  padding: 10px 20px;
  border-radius: 20px;
  background: var(--card-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px var(--card-shadow);
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--card-shadow);
}

.theme-toggle i {
  font-size: 1.2em;
}

/* 懒加载图片样式 */
.lazy-image {
  opacity: 0;
  transition: opacity 0.3s ease;
  background: linear-gradient(
    90deg,
    var(--border-color) 25%,
    transparent 50%,
    var(--border-color) 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

.lazy-image.loaded {
  opacity: 1;
  background: none;
  animation: none;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.pagination-container {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 5px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 15px;
  background: var(--card-bg);
  padding: 15px 25px;
  border-radius: 10px;
  box-shadow: 0 2px 8px var(--card-shadow);
  border: 1px solid var(--border-color);
}

.pagination-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-color);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--hover-bg);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--card-shadow);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.pagination-btn i {
  font-size: 16px;
}

/* 页码信息样式 */
.page-info {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.current-page {
  color: var(--active-bg);
  font-weight: 600;
}

.total-pages {
  color: var(--text-color);
}

.separator {
  color: var(--text-secondary);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .pagination {
    flex-direction: column;
    gap: 10px;
    padding: 15px 20px;
  }

  .pagination-btn {
    width: 100%;
    justify-content: center;
  }

  .page-info {
    order: -1;
  }
}

/* 加载状态指示器 */
.loading-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
  color: var(--text-secondary);
}

.loading-indicator i {
  font-size: 24px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
